﻿#ifndef DIALOG_H
#define DIALOG_H

#include <QDialog>
#include <QVector>
#include <QMouseEvent>
#include <QWheelEvent>
#include <QKeyEvent>
#include <QSettings>
#include <Qfile>


//#pragma execution_character_set("utf-8")

QT_BEGIN_NAMESPACE
namespace Ui { class Dialog; }
QT_END_NAMESPACE

extern QString str;


class Dialog : public QDialog
{
    Q_OBJECT

    struct T_ListofPerson//建立组，有序号，名字
    {
        QString number;
        QString name;
    };


public:
    Dialog(QWidget *parent = nullptr);
    ~Dialog();

private slots:
//    void on_pushButton_start_clicked();
    void onRangeChanged();//显示

    void on_pushButton_openFile_clicked();

    void on_LineEdit_list_editingFinished();

    void on_pushButton_clicked();

protected:
    void keyPressEvent(QKeyEvent *event);//键盘事件

    void mousePressEvent(QMouseEvent* event);//鼠标事件
private:
    void GetListFromFile(const QString &file);//只读不该，读人员名单
    void SaveSettings();
    void LoadSettings();

    void SelectWinner();//选中奖者
private:
    Ui::Dialog *ui;
    QTimer* timer1;//计时器
    QString m_loadFile;//自己设置的
    QString m_strWinner;//自己设置的
    QVector<T_ListofPerson> m_listPerson;
    int winner;//设置中奖人数
    QString m_iniFile;//自己设置的

};
#endif // DIALOG_H
